/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.cvut.fel.taskpro.business.imanager;

import cz.cvut.fel.taskpro.business.support.BusinessRuleException;
import cz.cvut.fel.taskpro.data.entity.Kantor;
import cz.cvut.fel.taskpro.data.entity.Student;
import cz.cvut.fel.taskpro.data.entity.Subject;
import java.util.List;
import javax.ejb.Local;

/**
 * This interface specify responsible action of business manager, which is
 * responsible for working with subjects.
 *
 * @author Tom
 * @version 1.0.0. beta
 */
@Local
public interface ISubjectBusiness {

    /**
     * This method ask validator to validate newSubject, if pass then ask data
     * layer for persist that object, otherwise the BusinessRuleException is
     * invoke.
     *
     * @param newSubject subject to add to DB
     */
    public void addSubject(Subject newSubject) throws BusinessRuleException;

    /**
     * Method ask data layer for remove subject based on code in parameter.
     *
     * @param code code of subject. Data layer will be asked to remove subject 
     * with this code. 
     */
    public void removeSubject(String code);

    /**
     * This method ask data layer for all subjects by code in parameter.
     *
     * @param code code of subject which will be searched
     * @return List of subject by code.
     */
    public List<Subject> showSubjects(String code);

    /**
     * This method ask data layer for all subjects in DB.
     * @return List of all subjects in DB.
     */
    public List<Subject> showSubjects();

    /**
     * This method ask data layer for all subjects which teach kantor in parameter.
     * Kantor must first pass throught business validation.
     * @param kantor kantor who teach subjects which will be found. Also will be validated-
     * @return list of all subjects which teach kantor.
     */
    public List<Subject> getSubjectsByTeacher(Kantor kantor) throws BusinessRuleException;
    
    /**
     * This method ask dataLayer for all subjects in which is student part of.
     * The validation must be pass correctly, otherwise BusinessRuleException is invoke.
     * @param student student by whom will be found subjects in which is he member of.
     * @return list of all subjects in which is student part of.
     */
    public List<Subject> getStudentsSubjects(Student student) throws BusinessRuleException;
}
